home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2006 September
/
PCWorld_2006-09_cd.bin
/
v cisle
/
hexer
/
mpth_17.exe
/
{app}
/
scripts
/
Structure Viewer
/
ntfs.mps
< prev
next >
Wrap
Text File
|
2006-03-19
|
5KB
|
186 lines
option title, "NTFS Boot structure"
=
=
= Tiny Hexer script for NTFS structure view in
= mirkes.de's tiny hex editor
=
= Adaptation of FAT16 (and built-in BMP) structure viewer
=
= 02-07-05 Bill Blankenship
=
option GlobalVars, 1
option ReadTags, 1
option target, structureviewer
= open active editor and goto current position/0
var editor file
editor = fileopen('::current')
if ((param_count > 0) and (dword(params(0))==1))
fileseek editor, 0
else
fileseek editor, filegetprop(editor, 'selstart')
endif
var start dword
start = filegetprop(editor, 'position')
= open browser window
var browser file
browser = fileopen('::browser', 'c')
filesetprop browser, 'accepttags', 1
filewrite browser "<font color=",'"',"blue",'"',"><b><u>NTFS Boot structure:</u></b></font>\n\n"
filesetprop browser, 'accepttags', 0
filewrite browser "Position: ",start,"\n\n"
= read the JMP instruction
var JMP1 byte JMP2 byte NOP byte
fileread editor JMP1
fileread editor JMP2
fileread editor NOP
= print JMP Instruction
filewrite browser "JMP instruction: \t\t'",JMP1," ",JMP2," ",NOP,"'\n"
var OEM text
fileread editor OEM 8
filewrite browser "OEM: \t\t\t\t'",OEM,"'\n"
= Do BIOS Parameter block
var bytespersect word sectpercluster byte reservedsect word
var res1 word res2 byte res3 dword mediatype byte
var totalsects qword mftlcn qword mftmirrlcn qword clustperrecord byte
var clustperindex byte volsn qword
fileread editor bytespersect
filewrite browser "Bytes per Sector: \t\t'",bytespersect,"' ("
call TO_DEC @bytespersect
filewrite browser " dec)\n"
fileread editor sectpercluster
filewrite browser "Sectors per cluster: \t\t'",sectpercluster,"' ("
call TO_DEC @sectpercluster
filewrite browser " dec)\n"
fileread editor reservedsect
filewrite browser "Reserved Sectors: \t\t'",reservedsect,"' ("
call TO_DEC @reservedsect
filewrite browser " dec)\n"
fileread editor res1
fileread editor res2
filewrite browser "Always zero: \t\t\t'",res1
NUMBER_PREFIX=''
filewrite browser res2,"'\n"
NUMBER_PREFIX='0x'
fileread editor res1
filewrite browser "Always zero: \t\t\t'",res1,"'\n"
fileread editor mediatype
filewrite browser "Media type: \t\t\t'",mediatype,"'\n"
fileread editor res1
filewrite browser "Always zero: \t\t\t'",res1,"'\n"
fileread editor res1
filewrite browser "Not used by NTFS: \t\t'",res1,"'\n"
fileread editor res1
filewrite browser "Not used by NTFS: \t\t'",res1,"'\n"
fileread editor res3
filewrite browser "Not used by NTFS: \t\t'",res3,"'\n"
fileread editor res3
filewrite browser "Always zero: \t\t\t'",res3,"'\n"
fileread editor res3
filewrite browser "Not used by NTFS: \t\t'",res3,"'\n"
fileread editor totalsects
filewrite browser "Total sectors: \t\t'",totalsects,"' ("
call TO_DEC @totalsects
filewrite browser " dec)\n"
fileread editor mftlcn
filewrite browser "LCN for $MFT: \t\t\t'",mftlcn,"' ("
call TO_DEC @mftlcn
filewrite browser " dec)\n"
fileread editor mftmirrlcn
filewrite browser "LCN for $MFTMirr: \t\t'",mftmirrlcn,"' ("
call TO_DEC @mftmirrlcn
filewrite browser " dec)\n"
= If this value is negative, then the FILE record is smaller than
= the cluster size. In this case the size of the record
= is: 2^abs(clustperrecord)
fileread editor clustperrecord
if clustperrecord > 0x7F
var bytesperrecord word
bytesperrecord = 0xFF - clustperrecord
bytesperrecord = 2 << bytesperrecord
filewrite browser "Bytes per $MFT record: \t'[",clustperrecord,"]-> ",bytesperrecord,"' ("
call TO_DEC @bytesperrecord
filewrite browser " dec)\n"
else
filewrite browser "Clusters per $MFT record: \t'",clustperrecord,"' ("
call TO_DEC @clustperrecord
filewrite browser " dec)\n"
endif
fileread editor res1
fileread editor res2
filewrite browser "Not used by NTFS: \t\t'",res1
NUMBER_PREFIX=''
filewrite browser res2,"'\n"
NUMBER_PREFIX='0x'
= If this value is negative, then the INDEX record is smaller than
= the cluster size. In this case the size of the record
= is: 2^abs(clustperindex)
fileread editor clustperindex
if clustperindex > 0x7F
var bytesperindex word
bytesperindex = 0xFF - clustperindex
bytesperindex = 2 << bytesperindex
filewrite browser "Bytes per Index record: \t'[",clustperindex,"]-> ",bytesperindex,"' ("
call TO_DEC @bytesperindex
filewrite browser " dec)\n"
else
filewrite browser "Clusters per Index record: \t'",clustperindex,"' ("
call TO_DEC @clustperindex
filewrite browser " dec)\n"
endif
fileread editor res1
fileread editor res2
filewrite browser "Not used by NTFS: \t\t'",res1
NUMBER_PREFIX=''
filewrite browser res2,"'\n"
NUMBER_PREFIX='0x'
fileread editor volsn
filewrite browser "Volume serial number (64 bit):\t'",volsn,"' \n"
fileread editor res3
filewrite browser "Not used by NTFS: \t\t'",res3,"'\n"
end
= decimal output - taken from BMP viewer
@@TO_DEC
number_radix = 10
number_prefix = ''
var _r1 varref
pop _r1
filewrite browser deref(_r1)
number_prefix = '0x'
number_radix = 16
return